home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disk User Volume 3 #8 / Commodore_Disk_User_Vol.3_8_1990_-.d64 / macro editor (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  15KB  |  537 lines

  1. 100 rem * macro editor  *
  2. 110 rem * for use with  *
  3. 120 rem * sid sequencer *
  4. 130 rem * by v.h.berry  *
  5. 140 rem *    c.1989     *
  6. 200 gosub 50010:rem initialisation
  7. 210 gosub 35010:rem main menu
  8. 220 print"[147]macro editor."
  9. 230 print"v.h.berry."
  10. 240 print"c.1989."
  11. 250 end
  12. 5000 rem tempo change
  13. 5010 vl=peek(49275):vl=vl+i:if vl=256 then vl=1
  14. 5020 if vl=0 then vl=255
  15. 5030 poke 49275,vl:poke 49276,0
  16. 5040 return
  17. 6000 rem sequencer on/off
  18. 6010 if mf=0 then mf=1:sys 49235:return
  19. 6020 mf=0:sys 49209:return
  20. 15000 rem block editor
  21. 15010 gosub 27010:rem edit screen
  22. 15100 get k$:if k$="" then 15100
  23. 15102 if k$="" then gosub 16030:sy=sy+1:gosub 16010:rem edit cursor down
  24. 15104 if k$="[145]" then gosub 16030:sy=sy-1:gosub 16010:rem edit cursor up
  25. 15106 if k$="" then gosub 16030:sx=sx+1:gosub 16010:rem edit cursor right
  26. 15108 if k$="[157]" then gosub 16030:sx=sx-1:gosub 16010:rem edit cursor left
  27. 15110 if k$="[147]" then gosub 16510:gosub 27010:rem clear channel
  28. 15120 if k$="" then gosub 17010:gosub 27010:rem delete block
  29. 15130 if k$="" then gosub 18010:rem write block
  30. 15135 if k$="" then gosub 16610:rem set begin marker
  31. 15136 if k$="" then gosub 16610:rem set end marker
  32. 15140 if k$="" then gosub 17510:rem insert block
  33. 15145 if k$="" then poke fsid,0:poke fsid+7,0:poke fsid+14,0:rem reset note counters
  34. 15150 if k$="f" then gosub 30010:gosub 27010:rem change filename
  35. 15160 if k$="p" then pg=pg+1:gosub 27010:rem next page
  36. 15165 if k$="[208]" then pg=pg-1:gosub 27010:rem previous page
  37. 15167 if k$="+" then i=-1:gosub 5010:rem increase tempo
  38. 15168 if k$="-" then i=1:gosub 5010:rem decrease tempo
  39. 15170 if k$=chr$(133) then os=os+1:gosub 27010:rem f1 next channel
  40. 15180 if k$=chr$(134) then gosub 28010:rem f3 help screen
  41. 15190 if k$=chr$(135) then gosub 6010:rem f5 sequencer on/off
  42. 15200 if k$=chr$(136) then return:rem f7 exit
  43. 15210 goto 15100
  44. 16000 rem cursor control
  45. 16010 if sx>7 then sx=0
  46. 16015 if sx<0 then sx=7
  47. 16020 if sy>7 then sy=0
  48. 16025 if sy<0 then sy=7
  49. 16030 y$="":print"";
  50. 16040 for i=0 to sy
  51. 16050 print"";
  52. 16060 next
  53. 16070 for i=0 to sx
  54. 16080 print"";
  55. 16090 next
  56. 16100 open 1,3
  57. 16110 for i=1 to 3
  58. 16120 get#1,x$
  59. 16130 y$=y$+x$
  60. 16140 next
  61. 16150 close 1
  62. 16155 if fg=0 then print"";:fg=1:goto 16160
  63. 16156 fg=0
  64. 16160 print"[157][157][157]";y$;"[146]"
  65. 16170 return
  66. 16500 rem clear channel
  67. 16510 print" clear channel data : press [return] [146]"
  68. 16520 get k$:if k$="" then 16520
  69. 16530 if k$<>chr$(13) then k$="":return
  70. 16540 n(os)=0
  71. 16550 poke ch+(os-1)*256,128
  72. 16560 poke ch+(os-1)*256+1,255
  73. 16570 return
  74. 16600 rem set block markers
  75. 16610 vl=pg*64+sy*8+sx:if vl>=n(os) then return
  76. 16620 if k$="" then bm=vl
  77. 16630 if k$="" then em=vl
  78. 16640 gosub 16710:rem print block values
  79. 16650 gosub 21030:rem colour subroutine
  80. 16660 return
  81. 16700 rem print block marker values
  82. 16710 print"                    [145]"
  83. 16720 print"block:";bm+1;"-";em+1
  84. 16730 return
  85. 17000 rem delete block
  86. 17010 print" delete block [146]  "
  87. 17020 if bm>em then 18310:rem block error
  88. 17030 if mf=1 then gosub 6010:rem seq. off
  89. 17040 i=0
  90. 17050 poke ch+(os-1)*256+bm+i,peek(ch+(os-1)*256+em+i+1)
  91. 17060 if peek(ch+(os-1)*256+bm+i)=255 then n(os)=n(os)-(em-bm+1):return
  92. 17070 i=i+1
  93. 17080 goto 17050
  94. 17500 rem insert block
  95. 17510 vl=pg*64+sy*8+sx:if vl>n(os) then return
  96. 17520 if vl>254 or n(os)+em-bm>255 then 18410:rem overflow
  97. 17525 if bm>em then 18310:rem block error
  98. 17526 print" insert block [146]  "
  99. 17530 if mf=1 then gosub 6010:rem seq. off
  100. 17540 for i=n(os)+1 to vl step -1
  101. 17550 poke ch+(os-1)*256+i+(em-bm)+1,peek(ch+(os-1)*256+i)
  102. 17560 next
  103. 17570 if bm>vl then gosub 18110:rem copy up
  104. 17575 if em<vl then gosub 18210:rem copy down
  105. 17580 n(os)=n(os)+(em-bm)+1
  106. 17590 gosub 27010:rem edit screen
  107. 17600 return
  108. 18000 rem write block
  109. 18010 vl=pg*64+sy*8+sx:if vl>n(os) then return
  110. 18020 if vl>254 or vl+em-bm>254 then 18410:rem overflow
  111. 18025 if bm>em then 18310:rem block error
  112. 18026 print" write block [146]   "
  113. 18030 if mf=1 then gosub 6010:rem seq. off
  114. 18040 if em<vl or bm>vl then gosub 18110:rem copy up
  115. 18050 if em>vl or bm<vl then gosub 18210:rem copy down
  116. 18060 if vl+em-bm<n(os) then 18090
  117. 18070 n(os)=vl+em-bm+1
  118. 18080 poke ch+(os-1)*256+n(os),255
  119. 18090 gosub 27010:rem edit screen
  120. 18095 return
  121. 18100 rem copy up
  122. 18110 i=0
  123. 18120 for j=bm to em
  124. 18130 if k$="" then poke ch+(os-1)*256+vl+i,peek(ch+(os-1)*256+j)
  125. 18135 if k$="" then poke ch+(os-1)*256+vl+i,peek(ch+(os-1)*256+j+(em-bm)+1)
  126. 18140 i=i+1
  127. 18150 next
  128. 18160 return
  129. 18200 rem copy down
  130. 18210 i=0
  131. 18220 for j=em to bm step -1
  132. 18230 poke ch+(os-1)*256+vl+em-bm+i,peek(ch+(os-1)*256+j)
  133. 18240 i=i-1
  134. 18250 next
  135. 18260 return
  136. 18300 rem block marker error
  137. 18310 print" block marker error [146]"
  138. 18320 gosub 21030:rem colour subroutine
  139. 18330 return
  140. 18400 rem data overflow error
  141. 18410 print" overflow error [146]"
  142. 18420 gosub 21030:rem colour subroutine
  143. 18430 return
  144. 21000 rem colour subroutine
  145. 21030 if os>3 then os=1
  146. 21040 if os=1 then print""
  147. 21050 if os=2 then print"[158]"
  148. 21060 if os=3 then print""
  149. 21070 return
  150. 27000 rem note edit screen
  151. 27010 print"[147] next chan  help  seq on/off  exit "
  152. 27020 print"     f1      f3       f5       f7  "
  153. 27070 print"[176][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][174]"
  154. 27080 print"{$7d}1{$7d}2{$7d}3{$7d}4{$7d}5{$7d}6{$7d}7{$7d}8{$7d}"
  155. 27090 print"[176]{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}[179]"
  156. 27100 print"{$7d}0+{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}"
  157. 27110 print"[171]{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}[179]"
  158. 27120 print"{$7d}8+{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}"
  159. 27130 print"[171]{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}[179]"
  160. 27140 print"{$7d}16+{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}"
  161. 27150 print"[171]{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}[179]"
  162. 27160 print"{$7d}24+{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}"
  163. 27170 print"[171]{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}[179]"
  164. 27180 print"{$7d}32+{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}"
  165. 27190 print"[171]{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}[179]"
  166. 27200 print"{$7d}40+{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}"
  167. 27210 print"[171]{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}[179]"
  168. 27220 print"{$7d}48+{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}"
  169. 27230 print"[171]{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}{$7b}{$60}{$60}{$60}[179]"
  170. 27240 print"{$7d}56+{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}{$7d}"
  171. 27250 print"[173]{$60}{$60}{$60}[177]{$60}{$60}{$60}[177]{$60}{$60}{$60}[177]{$60}{$60}{$60}[177]{$60}{$60}{$60}[177]{$60}{$60}{$60}[177]{$60}{$60}{$60}[177]{$60}{$60}{$60}[177]{$60}{$60}{$60}[189]"
  172. 27260 print"file:";n$
  173. 27265 gosub 16710:rem print block values
  174. 27270 gosub 21030:rem colour subroutine
  175. 27280 print"channel:";os
  176. 27285 if pg*64>n(os) then pg=0
  177. 27286 if pg<0 then pg=int((n(os)-1)/64)
  178. 27290 print"notes:page:[145]"
  179. 27300 print tab(9);n(os);tab(24);pg*64+1;"-";(pg+1)*64
  180. 27302 rem initialise cursor controls
  181. 27304 sx=0:sy=0:fg=0
  182. 27310 rem print note data
  183. 27320 i=0:ll=0:print"";
  184. 27330 vl=peek(ch+(os-1)*256+pg*64+i)
  185. 27340 if vl=128 then nl$="r  ":goto 27385:rem rest
  186. 27350 if vl=255 then nl$=":  ":goto 27385:rem end of data
  187. 27360 gosub 27510:rem note/octave string
  188. 27385 print nl$;"";
  189. 27390 i=i+1:if i=64 or vl=255 then gosub 16030:return
  190. 27395 ll=ll+1:if ll=8 then ll=0:print:print"";
  191. 27400 goto 27330
  192. 27500 rem note letter/octave string
  193. 27510 ov=int(vl/16):rem octave
  194. 27520 o$=str$(ov):o$=right$(o$,1)
  195. 27530 nl$=l$(vl-ov*16):rem note letter name
  196. 27540 nl$=nl$+o$:if len(nl$)=2 then nl$=nl$+" "
  197. 27550 return
  198. 28000 rem help screen
  199. 28010 poke 53280,5:poke 53281,5:print"[147]";
  200. 28011 print" press [f7] to exit :                   [176]{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}";
  201. 28012 print"[192][192][192][192][192][192][192][192][192][174][221][f][146][144]cha";
  202. 28013 print"ngefilename{$7d}{$7d}{$7d}{$7d}[p]";
  203. 28014 print"[146][144]nextpage{$7d}{$7d}[shift] & [p][146][144]previouspage";
  204. 28015 print"{$7d}{$7d}{$7d}{$7d}[+][146][144]increas";
  205. 28016 print"etempo{$7d}{$7d}[-][146][144]decreasetempo{$7d}{$7d}";
  206. 28017 print"{$7d}{$7d}[home][146][144]resetnotecounters";
  207. 28018 print"{$7d}{$7d}{$7d}{$7d}[146][144]editcontrols:[crsr][146]";
  208. 28019 print"[144]movecursor{$7d}{$7d}[146][144]{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$7d}{$7d}[ctrl] &";
  209. 28020 print" [b][146][144]'begin'blockmark{$7d}{$7d}[ctrl] & [e][146][144]'end'blockmark";
  210. 28021 print"{$7d}{$7d}{$7d}{$7d}[ctrl] & [d][146][144]delete";
  211. 28022 print"block{$7d}{$7d}[ctrl] & [w][146][144]writeblockatcrsr{$7d}{$7d}[ctrl] &";
  212. 28023 print" [i][146][144]insertblockatcrsr{$7d}{$7d}";
  213. 28024 print"[221][221][shift] & [clr][146][144]clearchannel[221]";
  214. 28025 print"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]";
  215. 28026 print"[192][192][192][192][192][192][192][192][192][189]"
  216. 28160 get k$:if k$="" then 28160
  217. 28170 if k$<>chr$(136) then 28160
  218. 28180 k$=""
  219. 28190 poke 53280,0:poke 53281,0
  220. 28200 gosub 27010:rem note edit ecreen
  221. 28210 return
  222. 30000 rem input new filename
  223. 30010 poke 53280,5:poke 53281,5
  224. 30020 print"[147] enter new filename : press [return]  [146]";
  225. 30030 print
  226. 30040 print"file : ";n$
  227. 30050 print""
  228. 30060 l=14:tb=5:rs=1:gosub 32040:rem input subroutine
  229. 30070 if a>0 then n$=y$
  230. 30080 poke 53280,0:poke 53281,0
  231. 30090 return
  232. 32000 rem input restriction subroutine
  233. 32010 rem l=length of input
  234. 32020 rem tb=tabulation of routine
  235. 32030 rem rs=character restrictions
  236. 32040 a=0:y$="":sp=1
  237. 32050 print tab(tb+l+1):print"[145][174][157][189][145]";:for x=0 to l+1:print"[157][157] ";:next:print"[145][176][157][173][145][144][164][157]";
  238. 32060 get x$:if x$="" then 32060
  239. 32070 if x$=chr$(160) or x$=" " or x$=chr$(20) or x$=chr$(13) then 32130
  240. 32080 if rs=0 then if x$=>"0" and x$=<"9" then 32130
  241. 32090 if rs=1 and x$=>chr$(35) and x$=<chr$(93) then 32130
  242. 32100 goto 32060
  243. 32110 if a=l-1 then print"[157][157]";
  244. 32120 goto 32060
  245. 32130 if x$=chr$(20) and a=0 then 32060
  246. 32140 if x$=chr$(13) and right$(y$,1)=" " then y$=left$(y$,len(y$)-1):a=a-1
  247. 32150 if x$=chr$(13) then print:return
  248. 32160 a=a+1:if x$<>chr$(32) then sp=0
  249. 32170 if a>l and x$<>chr$(20) then x$="":a=a-1
  250. 32180 if a<1 then x$="":a=0
  251. 32190 if x$=chr$(20) then print tab(a)"[157][164] [157][157]";:a=a-2:y$=left$(y$,len(y$)-1):goto 32110
  252. 32200 if x$=chr$(32) and sp=1 then x$="":a=a-1
  253. 32210 if x$=chr$(32) then sp=sp+1
  254. 32220 y$=y$+x$:print x$;:if a<l then print"[164][157]";
  255. 32230 goto 32060
  256. 35000 rem main menu
  257. 35010 print"[147] move cursor up & down:press [return]   [146]"
  258. 35020 print"***macro editor***"
  259. 35030 print"v.h.berry c.1989"
  260. 35040 print"        [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  261. 35060 print"            macro editor    "
  262. 35070 print"            hardcopy        "
  263. 35080 print"            disk menu       "
  264. 35090 print"            exit program    "
  265. 35100 print
  266. 35110 print"        [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  267. 35120 print"":t1=10:ll=3:gosub 39010:rem menu system routine
  268. 35130 if a=3 then return
  269. 35140 on a+1 gosub 15010,36010,37020
  270. 35150 goto 35010
  271. 36000 rem hardcopy menu
  272. 36010 print"[147] move cursor up & down:press [return]   [146]"
  273. 36020 print"***   hardcopy    ***"
  274. 36030 print"file : ";n$
  275. 36040 print"        [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  276. 36050 print"            new filename    "
  277. 36060 print"            horizontal print"
  278. 36070 print"            vertical print  "
  279. 36080 print"            exit menu       "
  280. 36090 print"        [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  281. 36100 print"":t1=10:ll=3:gosub 39010:rem menu system routine
  282. 36110 if a=3 then return
  283. 36120 on a+1 gosub 30010,46010,47010
  284. 36130 goto 36010
  285. 37000 rem disk menu
  286. 37020 print"[147] move cursor up & down:press [return]   [146]"
  287. 37030 print"***   disk menu   ***"
  288. 37040 print"file : ";n$
  289. 37050 print"        [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  290. 37060 print"            new filename    "
  291. 37070 print"            load sid        "
  292. 37090 print"            load music      "
  293. 37095 print"            append music    "
  294. 37100 print"            save music      "
  295. 37110 print"            disk commands   "
  296. 37120 print"            exit menu       "
  297. 37130 print
  298. 37140 print"        [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  299. 37150 print"":t1=10:ll=6:gosub 39010:rem menu system routine
  300. 37160 if a=6 then return
  301. 37165 if a>0 and a<6 and mf=1 then gosub 6010:rem turn off sequencer
  302. 37170 on a+1 gosub 30010,42010,40010,40010,41010,45010
  303. 37180 goto 37020
  304. 38000 rem disk command menu
  305. 38010 print"[147] move cursor up & down:press [return]   [146]"
  306. 38020 print"***disk commands***"
  307. 38030 print"file : ";n$
  308. 38040 print"        [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  309. 38045 print"            disk directory  "
  310. 38050 print"            intialise disk  "
  311. 38060 print"            scratch sid     "
  312. 38070 print"            scratch music   "
  313. 38080 print"            scratch both    "
  314. 38090 print"            validate disk   "
  315. 38100 print"            exit menu       "
  316. 38110 print
  317. 38120 print"        [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  318. 38130 print"":t1=10:ll=6:gosub 39010:rem menu system routine
  319. 38140 return
  320. 38500 rem directory menu
  321. 38505 if dy*12>fi then dy=0
  322. 38510 print"[147] move cursor up & down:press [return]   [146]"
  323. 38520 print"***disk directory***"
  324. 38525 print"blocks free : ";bf
  325. 38530 print"        [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  326. 38540 print"            ";n$;""
  327. 38550 for i=12*dy to 11+(12*dy)
  328. 38555 if i>fi then print:goto 38570
  329. 38560 print"            ";fi$(i)
  330. 38570 next i
  331. 38575 print"            next page"
  332. 38580 print"        [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  333. 38590 print"":t1=10:ll=13:gosub 39010:rem menu system routine
  334. 38592 if a=13 then dy=dy+1:goto 38505
  335. 38593 if a=0 then 38600
  336. 38594 if len(fi$((a-1)+12*dy))<3 then 38600
  337. 38595 n$=left$(fi$((a-1)+12*dy),len(fi$((a-1)+12*dy))-2)
  338. 38600 return
  339. 39000 rem menu system routine
  340. 39010 a=0:print tab(t1);">"
  341. 39020 get x$:if x$="" then 39020
  342. 39030 if a=ll and x$=chr$(17) then a=a-1:print"[145][145]"
  343. 39040 if a=0 and x$=chr$(145) then a=a+1:print
  344. 39050 if x$=chr$(17) then a=a+1:print tab(t1);"[145] [157]>"
  345. 39060 if x$=chr$(145) then a=a-1:print tab(t1);"[145] [157][145]>"
  346. 39070 if x$=chr$(13) then return
  347. 39080 goto 39020
  348. 40000 rem load music file
  349. 40010 x$=".1":i=0:fg=0:if a=3 then fg=1
  350. 40020 n=0:if fg=1 then n=n(i+1)
  351. 40030 open 15,8,15
  352. 40040 open 2,8,2,n$+x$+",s,r"
  353. 40050 input#15,en,er$,tr,se
  354. 40060 if en<>0 then print"[147] load[146]";:goto 44010
  355. 40070 print" loading music file :                [146]";
  356. 40080 input#2,a
  357. 40090 poke ch+i*256+n,a
  358. 40095 if n=255 then poke ch+i*256+n,255:goto 40110
  359. 40100 if a<>255 then n=n+1:goto 40080
  360. 40110 n(i+1)=n
  361. 40120 close 2
  362. 40130 close 15
  363. 40140 if i=0 then i=1:x$=".2":goto 40020
  364. 40150 if i=1 then i=2:x$=".3":goto 40020
  365. 40160 return
  366. 41000 rem save music file
  367. 41010 x$=".1":i=0
  368. 41020 n=0
  369. 41030 open 15,8,15
  370. 41040 open 2,8,2,n$+x$+",s,w"
  371. 41050 input#15,en,er$,tr,se
  372. 41060 if en<>0 then print"[147] save[146]";:goto 44010
  373. 41070 print" saving music file :                 [146]";
  374. 41080 a=peek(ch+i*256+n)
  375. 41090 print#2,a
  376. 41100 if a<>255 then n=n+1:goto 41080
  377. 41110 close 2
  378. 41120 close 15
  379. 41130 if i=0 then i=1:x$=".2":goto 41020
  380. 41140 if i=1 then i=2:x$=".3":goto 41020
  381. 41150 return
  382. 42000 rem load fsid registers
  383. 42010 open 15,8,15
  384. 42020 open 2,8,2,n$+".s,s,r"
  385. 42030 input#15,en,er$,tr,se
  386. 42040 if en<>0 then print"[147] load[146]";:goto 44010
  387. 42050 print" loading sound file :                [146]";
  388. 42060 input#2,a
  389. 42070 poke 49275,a
  390. 42080 for ce=0 to 2
  391. 42090 for reg=0 to 6
  392. 42100 input#2,a
  393. 42110 poke fsid+reg+7*ce,a
  394. 42120 next reg,ce
  395. 42130 close 2
  396. 42140 close 15
  397. 42150 return
  398. 44000 rem file error routine
  399. 44010 close 2:close 15
  400. 44020 print" error : press [return]          [146]";:print
  401. 44030 print"file : ";n$
  402. 44040 print"error # : ";en:print"";er$:print"tr = ";tr;" : se = ";se
  403. 44050 get k$:if k$<>chr$(13) then 44050
  404. 44060 return
  405. 45000 rem disk routines
  406. 45010 open 15,8,15
  407. 45020 gosub 38010:rem disk command menu
  408. 45030 if a=6 then close 15:return
  409. 45035 if mf=1 then gosub 6010:rem turn off sequencer
  410. 45037 if a=0 then gosub 45300:gosub 38510:goto 45020:rem directory
  411. 45040 if a>1 then 45080
  412. 45050 print" intialise disk :                    [146]"
  413. 45060 print#15,"i"
  414. 45070 goto 45020
  415. 45080 if a<>5 then 45120
  416. 45090 print" validate disk :                     [146]"
  417. 45100 print#15,"v"
  418. 45110 goto 45020
  419. 45120 if a=2 then 45160
  420. 45125 print" scratch music file :                [146]"
  421. 45130 print#15,"s:"+n$+".1"
  422. 45132 print#15,"s:"+n$+".2"
  423. 45134 print#15,"s:"+n$+".3"
  424. 45150 if a=3 then 45020
  425. 45160 print" scratch sound file :                [146]"
  426. 45170 print#15,"s:"+n$+".s"
  427. 45180 goto 45020
  428. 45200 rem disk directory read
  429. 45300 i=0:fi$(i)=""
  430. 45310 open 1,8,0,"$0"
  431. 45320 get#1,a$,b$
  432. 45330 get#1,a$,b$
  433. 45340 get#1,a$,b$
  434. 45350 c=0
  435. 45360 if a$<>"" then c=asc(a$)
  436. 45370 if b$<>"" then c=c+asc(b$)*256
  437. 45380 bf=c
  438. 45390 get#1,b$:if st<>0 then 45470
  439. 45400 if b$<>chr$(34) then 45390
  440. 45410 get#1,b$:if b$<>chr$(34) then fi$(i)=fi$(i)+b$:goto 45410
  441. 45420 get#1,b$:if b$=chr$(32) then 45420
  442. 45425 if right$(fi$(i),2)=".1" then fi$(i)=left$(fi$(i),len(fi$(i))-1)+"m":i=i+1
  443. 45426 if right$(fi$(i),2)=".s" then i=i+1
  444. 45427 if i=37 then 45470
  445. 45430 c$="":fi$(i)=""
  446. 45440 c$=c$+b$:get#1,b$:if b$<>"" then 45440
  447. 45450 if st=0 then 45330
  448. 45460 close 1
  449. 45470 fi=i:dy=0
  450. 45480 close 1:return
  451. 46000 rem horizontal hardcopy
  452. 46010 open 4,4
  453. 46012 print#4,chr$(27);chr$(108);chr$(6):rem left margin (col=6)
  454. 46020 print#4,"file: ";n$
  455. 46030 for os=1 to 3
  456. 46040 print#4,chr$(13)
  457. 46042 print#4,"channel:";os
  458. 46044 print#4,chr$(13);pc$;
  459. 46046 j=0:gosub 46210:rem print note#
  460. 46051 for i=0 to n(os)-1
  461. 46052 vl=peek(ch+(os-1)*256+i)
  462. 46054 if vl=128 then nl$="r  ":goto 46066:rem rest
  463. 46060 gosub 27510:rem note/octave string
  464. 46066 print#4,nl$;" ";
  465. 46068 ll=ll+1:if ll=16 then j=j+4:gosub 46210:rem next line
  466. 46070 next i
  467. 46075 print#4,chr$(13)
  468. 46080 next os
  469. 46085 print#4,chr$(12)
  470. 46090 close 4
  471. 46100 return
  472. 46200 rem print note#
  473. 46210 ll=0:y$=mid$(ps$,j+1,4)
  474. 46220 print#4,chr$(13)
  475. 46230 print#4,y$;"  ";
  476. 46250 return
  477. 47000 rem vertical hardcopy
  478. 47010 open 4,4
  479. 47012 print#4,chr$(27);chr$(108);chr$(4):rem left margin (col=4)
  480. 47020 print#4,"file: ";n$
  481. 47025 j=0
  482. 47030 gosub 46210:rem print note#
  483. 47035 print#4,chr$(13);"  ";pc$;
  484. 47040 for os=1 to 3
  485. 47042 print#4,chr$(13)
  486. 47043 print#4,"chan";os;" ";
  487. 47050 vl=peek(ch+(os-1)*256+ll+j*4)
  488. 47060 if ll+j*4>=n(os) then 47110:rem abort line
  489. 47070 if vl=128 then nl$="r  ":goto 47090:rem rest
  490. 47080 gosub 27510:rem note/octave string
  491. 47090 print#4,nl$;" ";
  492. 47100 ll=ll+1:if ll<16 then 47050
  493. 47110 ll=0
  494. 47120 next os
  495. 47130 j=j+4
  496. 47140 if j*4<n(1) or j*4<n(2) or j*4<n(3) then 47030
  497. 47150 print#4,chr$(12)
  498. 47160 close 4
  499. 47170 return
  500. 50000 rem initialisation
  501. 50010 if peek(51712)=1 then 50112:rem machine code present
  502. 50020 rem load machine code
  503. 50030 poke 53280,5:poke 53281,5
  504. 50040 print"[147][176][174]"
  505. 50050 print"macro editor"
  506. 50060 print"v.h.berryc.1989"
  507. 50070 print"[173][189]"
  508. 50080 print"loadingmachinecode"
  509. 50090 fg=fg+1:if fg=1 then load"sequencer mc",8,1
  510. 50100 if fg=2 then load "note table mc",8,1
  511. 50112 dim fi$(36)
  512. 50115 dim l$(11):rem note letter names
  513. 50120 ch=51968:rem music data address
  514. 50140 fsid=49175:rem false sid data address
  515. 50150 nh=51712:rem note table high byte
  516. 50160 nl=51840:rem note table low byte
  517. 50170 mf=0:rf=0:rem music & record flag
  518. 50210 n$="music file"
  519. 50220 pc$="note# +1  +2  +3  +4  +5  +6  +7  +8  +9  +10 +11 +12 +13 +14 +15"
  520. 50230 pc$=pc$+" +16"
  521. 50240 ps$="+0  +16 +32 +48 +64 +80 +96 +112+128+144+160+176+192+208+224+240"
  522. 50282 rem read note letter names
  523. 50284 for i=0 to 11
  524. 50286 read a$
  525. 50288 l$(i)=a$
  526. 50289 next
  527. 50290 for os=1 to 3
  528. 50300 gosub 16540:rem clear channel data
  529. 50310 next
  530. 50320 os=1:rem edit voice 1
  531. 50330 poke 53280,0:poke 53281,0
  532. 50340 return
  533. 60200 rem note letter name data
  534. 60210 data "c","c#","d","d#"
  535. 60220 data "e","f","f#","g"
  536. 60230 data "g#","a","a#","b"
  537.